import {createStore, compose, applyMiddleware} from 'redux';
import reducers from './reducers/index';
import thunk from 'redux-thunk';
import {createLogger} from 'redux-logger';

let enhancer = compose(
  //这里加了两个中间件，一个是处理异步操作的thunk，还有一个是用来调试阶段方便查看的logger,最终打包的时候logger可以去掉
  applyMiddleware(thunk, createLogger())
);

const store = createStore(reducers, enhancer);

export default store

